export default class DamageTotal {
    private static takeDamageTable: number[][] = [];
    private static makeDamageTable: number[][] = [];
    private static makeHealTable: number[][] = [];
    static addTakeDamageRecord(wave: number, index: number, dmg: number) {
        if (DamageTotal.takeDamageTable[wave] == null) {
            DamageTotal.takeDamageTable[wave] = [];
        }
        if (DamageTotal.takeDamageTable[wave][index] == null) {
            DamageTotal.takeDamageTable[wave][index] = 0;
        }
        DamageTotal.takeDamageTable[wave][index] += dmg;
    }
    static addMakeDamageRecord(wave: number, index: number, dmg: number) {
        if (DamageTotal.makeDamageTable[wave] == null) {
            DamageTotal.makeDamageTable[wave] = [];
        }
        if (DamageTotal.makeDamageTable[wave][index] == null) {
            DamageTotal.makeDamageTable[wave][index] = 0;
        }
        DamageTotal.makeDamageTable[wave][index] += dmg;
    }
    static addHealRecord(wave: number, index: number, dmg: number) {
        if (DamageTotal.makeHealTable[wave] == null) {
            DamageTotal.makeHealTable[wave] = [];
        }
        if (DamageTotal.makeHealTable[wave][index] == null) {
            DamageTotal.makeHealTable[wave][index] = 0;
        }
        DamageTotal.makeHealTable[wave][index] += dmg;
    }
    static getCurrentWaveTakeDamageMaxPlayerIndex() {
        let index = 0;
        let d = DamageTotal.takeDamageTable[game_wave];
        if (d == null) {
            return null;
        }
        let value = d[0];
        for (let i = 1; i < d.length; i++) {
            if (d[i] > d[index]) {
                index = i;
                value = d[i];
            }
        }
        return { index, value };
    }
    static getCurrentWaveMakeDamageMaxPlayerIndex() {
        let index = 0;
        let d = DamageTotal.makeDamageTable[game_wave];
        if (d == null) {
            return null;
        }
        let value = d[0];
        for (let i = 1; i < d.length; i++) {
            if (d[i] > d[index]) {
                index = i;
                value = d[i];
            }
        }
        return { index, value };
    }
    static getCurrentWaveHealMaxPlayerIndex() {
        let index = 0;
        let d = DamageTotal.makeHealTable[game_wave];
        if (d == null) {
            return null;
        }
        let value = d[0];
        for (let i = 1; i < d.length; i++) {
            if (d[i] > d[index]) {
                index = i;
                value = d[i];
            }
        }
        return { index, value };
    }
}
